package com.hsd.mapper;

import com.hsd.entity.Goods;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface GoodsMapper {

    /**
     * 通过标记查询该标记下的所有商品信息
     * @param tag
     * @return
     */
    @Results(id = "GoodsResults",value = {
            @Result(id = true,property = "id",column = "g_id"),
            @Result(property = "img",column = "g_img"),
            @Result(property = "name",column = "g_name"),
            @Result(property = "link",column = "g_link"),
            @Result(property = "price",column = "g_price"),
            @Result(property = "number",column = "g_number"),
            @Result(property = "desrc",column = "g_desrc"),
            @Result(property = "tag",column = "g_tag"),
            @Result(property = "category",column = "g_category")
    })
    @Select("select * from t_goods where g_tag=#{tag}")
    List<Goods> selectByTag(String tag);
}
